module GYLite
{
				
		

	export class Listener //implements IPoolObject
	{
		private _listenerVec:IListener[];
		private _listenId:number;
		private _inPool:boolean;
		private static c:number=0;
		public constructor()
		{var s = this;
			s._listenerVec = new Array<IListener>();
			s._listenId = Listener.c++;
		}
//		public outPoolInit():void
//		{var s = this;
//			s._listenId = getTimer();
//		}
		public addListener(listener:IListener):number
		{var s = this;
			if(s._listenerVec.indexOf(listener) == -1)
				s._listenerVec.push(listener);
			return s._listenId;
		}
		public removeListener(listener:IListener):number
		{var s = this;
			var ind:number;
			ind = s._listenerVec.indexOf(listener);
			if(ind == -1)return s._listenId;
			s._listenerVec.splice(ind, 1);
			return s._listenId;
		}
		public dataChange():void
		{var s = this;
			var len:number;
			len = s._listenerVec.length;
			if(len > 0)
			{
				while(--len>-1)
				{
					s._listenerVec[len].dataChange(s._listenId);
				}
			}
		}

		public get listenId():number
		{var s = this;
			return s._listenId;
		}

//		public clear():void
//		{var s = this;
//			PoolUtil.toPool(this, Listener);
//		}
//		
//		public get inPool():boolean
//		{var s = this;
//			return s._inPool;
//		}
//		
//		public set inPool(val:boolean)
//		{var s = this;
//			s._inPool = val;
//		}
	}
}